﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Silverlight.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using PlottingBasics.LINQHelpers;

namespace t_PlottingBasics
{
    [TestClass]
    public class t_TranslateIf
    {
        [TestMethod]
        public void TestBasic()
        {
            var ar = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 };
            var result = ar.TranslateIf(3.5,
                a => a,
                a => 0.0,
                a => a).ToArray();
            Assert.AreEqual(5, result.Count(), "Wrong size of sequence back");
            Assert.AreEqual(0.0, result[0], "0 is not right");
            Assert.AreEqual(0.0, result[1], "0 is not right");
            Assert.AreEqual(0.0, result[2], "0 is not right");
            Assert.AreEqual(4.0, result[3], "0 is not right");
            Assert.AreEqual(5.0, result[4], "0 is not right");
        }
    }
}